import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { RouterModule, Routes } from '@angular/router';
import { HomeComponent } from './pages/home/home.component';
import { AboutComponent } from './pages/about/about.component';
import { IntroduceComponent } from './pages/about/introduce/introduce.component';
import { HistoryComponent } from './pages/about/history/history.component';
import { NotFoundComponent } from './pages/not-found/not-found.component';


const routes: Routes = [
  {
    path: "home",
    component: HomeComponent,
  },
  {
    path: "about",
    component: AboutComponent,
    children: [
      {
        path: "introduce",
        component: IntroduceComponent,
        outlet:'left'
      },
      {
        path: "history",
        component: HistoryComponent,
        outlet:'right'
      }
    ]
  },
  {
    path:'user',
    loadChildren:()=>import ('./user/user.module').then(m=>{
      console.log(m)
      return m.UserModule
    })
  },
  {
    path: "",
    redirectTo: "home",
    pathMatch: "full",
  },
  {
    path: "**",
    component: NotFoundComponent
  }
];

@NgModule({
  declarations: [],
  imports: [
    CommonModule,
    RouterModule.forRoot(routes,{useHash:true})
  ],
  exports:[RouterModule]
})
export class AppRoutingModule { }
